package com.felight.list;

import java.util.ArrayList;
import java.util.Collections;

/**
 * ArrayList which stores Flower objects is created and sorting is done using
 * comparator.
 * 
 * @author soumya
 * 
 */
public class Shop {
	public static void main(String[] args) {
		ArrayList<Flower> lst = new ArrayList<Flower>();
		Flower f1 = new Flower("rose", 10);
		Flower f2 = new Flower("lilly", 8);
		lst.add(f1);
		lst.add(f2);
		FlowerNameCom fn = new FlowerNameCom(); // used for sorting based on
												// names
		FlowerPriceComparator fw = new FlowerPriceComparator(); // used for
																// sorting based
																// on price
		Collections.sort(lst, fn); // sorting based on name is done by passing
									// fn
		for (Flower f : lst) {
			System.out.println(f.name);
		}
	}
}
